﻿/***************************************************COPYRIGHT***************************************
* Copyright (c) 2008, Whiteboard-IT
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that 
* the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following 
 * disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
 * disclaimer in the documentation and/or other materials provided with the distribution.
*
* Neither the name of Whiteboard-IT, LLC nor the names of its contributors may be used to endorse or promote 
 * products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
*****************************************************************************************************************/
using System.Data;
using Boo.Lang;

namespace Mite
{
	public abstract partial class MigrationBase
	{
		#region Nested type: AnsiString

		/// <summary>
		/// Maps to Varchar (MsSql)
		/// </summary>
		public class AnsiString : Column
		{
			/// <summary>
			/// Creates an instance of AnsiString
			/// </summary>
			private AnsiString(): this("", 255)
			{
			}

			/// <summary>
			/// Creates an instance of AnsiString
			/// </summary>
			public AnsiString(string name, uint length)
				: this(name, length, ColumnAttributes.None)
			{
			}

			/// <summary>
			/// Creates an instance of AnsiString
			/// </summary>
			public AnsiString(string name, ColumnAttributes attributes)
				: this(name, 255, attributes)
			{
			}

			/// <summary>
			/// Creates an instance of AnsiString
			/// </summary>
			public AnsiString(string name, uint length, ColumnAttributes attributes)
				: base(name, DbType.AnsiString, attributes)
			{
				Length = length;
			}
		}

		#endregion

		#region Nested type: AnsiStringFixedLength

		/// <summary>
		/// Maps to Char (MsSql)
		/// </summary>
		public class AnsiStringFixedLength : Column
		{
			private AnsiStringFixedLength(): base("", DbType.AnsiStringFixedLength)
			{
				Length = 255;
			}
		}

		#endregion

		#region Nested type: Binary

		/// <summary>
		/// Maps to VarBinary (MsSql)
		/// </summary>
		public class Binary : Column
		{
			private Binary(string name): base(name, DbType.Binary)
			{
			}
		}

		#endregion

		#region Nested type: Boolean

		/// <summary>
		/// Column that can contain a <c>true</c> or <c>false</c> value.
		/// </summary>
		public class Boolean : Column
		{
			/// <summary>
			/// Creates an instance of Boolean.
			/// </summary>
			/// <param name="name"></param>
			public Boolean(string name): base(name, DbType.Boolean)
			{
			}
		}

		#endregion

		#region Nested type: Byte

		/// <summary>
		/// Maps to TinyInt (MsSql)
		/// </summary>
		public class Byte : Column
		{
			public Byte(string name): base(name, DbType.Byte)
			{
			}
		}

		#endregion

		#region Nested type: Currency

		/// <summary>
		/// Maps to Money (MsSQL)
		/// </summary>
		public class Currency : Column
		{
			private Currency(string name): base(name, DbType.Currency)
			{
			}
		}

		#endregion

		#region Nested type: Date

		/// <summary>
		/// Maps to DateTime (MsSql)
		/// </summary>
		public class Date : Column
		{
			private Date(string name) : base(name, DbType.Date)
			{
			}
		}

		#endregion

		#region Nested type: DateTime

		/// <summary>
		/// Column for storing <see cref="System.DateTime"/> values.
		/// </summary>
		public class DateTime : Column
		{
			/// <summary>
			/// Creates an instance of <see cref="DateTime"/>.
			/// </summary>
			public DateTime(string name)
				: base(name, DbType.DateTime)
			{
			}
		}

		#endregion

		#region Nested type: Decimal

		/// <summary>
		/// Column for storing numeric values that can contain decimals.
		/// </summary>
		public class Decimal : Column
		{
			/// <summary>
			/// Creates an instance of Decimal.
			/// </summary>
			public Decimal(string name): this(name, null)
			{
			}

			/// <summary>
			/// Creates an instance of Decimal.
			/// </summary>
			public Decimal(string name, Hash options): base(name, DbType.Decimal, options)
			{
			}
		}

		#endregion

		#region Nested type: Double

		/// <summary>
		/// Maps to Float (MsSql)
		/// </summary>
		public class Double : Column
		{
			private Double(string name, Hash options): base(name, DbType.Double, options)
			{
			}
		}

		#endregion

		#region Nested type: Guid

		/// <summary>
		/// Column for storing unique identifiers.
		/// </summary>
		public class Guid : Column
		{
			/// <summary>
			/// Creates a non nullable instance of Guid.
			/// </summary>
			/// <param name="name">Name for the column.</param>
			public Guid(string name): this(name, ColumnAttributes.NotNull, null)
			{
			}

			public Guid(Hash options)
				: this("", ColumnAttributes.NotNull, options)
			{
			}

			public Guid(string name, Hash options): this(name, ColumnAttributes.NotNull, options)
			{
			}

			public Guid(string name, ColumnAttributes attributes, Hash options): base(name, DbType.Guid, options)
			{
			}
		}

		#endregion

		#region Nested type: Int16

		/// <summary>
		/// Column for storing 16 bit integers.
		/// </summary>
		public class Int16 : Column
		{
			public Int16(string name): this(name, null)
			{
			}

			public Int16(string name, Hash options): base(name, DbType.Int16, options)
			{
			}
		}

		#endregion

		#region Nested type: Int32

		/// <summary>
		/// Column for storing 32 bit integers.
		/// </summary>
		public class Int32 : Column
		{
			/// <summary>
			/// Creates an instance of Int32.
			/// </summary>
			public Int32(string name): this(name, null)
			{
			}

			/// <summary>
			/// Creates an instance of Int32.
			/// </summary>
			public Int32(string name, ColumnAttributes attributes): this(name, attributes, null)
			{
			}

			/// <summary>
			/// Creates an instance of Int32.
			/// </summary>
			public Int32(string name, Hash options): this(name, ColumnAttributes.None, options)
			{
			}

			/// <summary>
			/// Creates an instance of Int32.
			/// </summary>
			public Int32(string name, ColumnAttributes attributes, Hash options): base(name, DbType.Int32, attributes, options)
			{
			}
		}

		#endregion

		#region Nested type: Int64

		/// <summary>
		/// Column for storing 64 bit integers.
		/// </summary>
		public class Int64 : Column
		{			
			/// <summary>
			/// Creates an instance of Int32.
			/// </summary>
			public Int64(string name): this(name, null)
			{
			}

			/// <summary>
			/// Creates an instance of Int32.
			/// </summary>
			public Int64(string name, Hash options): this(name, ColumnAttributes.None, options)
			{
			}

			/// <summary>
			/// Creates an instance of Int32.
			/// </summary>
			public Int64(string name, ColumnAttributes attributes, Hash options): base(name, DbType.Int64, attributes, options)
			{
			}
		}

		#endregion

		#region Nested type: Object

		/// <summary>
		/// Maps to Sql-Variant (MsSql)
		/// </summary>
		public class Object : Column
		{
			public Object(string name, Hash options): base(name, DbType.Object, options)
			{
			}
		}

		#endregion

		#region Nested type: Single

		/// <summary>
		/// Maps to Real ( MsSql)
		/// </summary>
		public class Single : Column
		{
			public Single(string name, Hash options): base(name, DbType.Single, options)
			{
			}

		}

		#endregion

		#region Nested type: String

		/// <summary>
		/// Column for storing UTF-8 strings.
		/// </summary>
		public class String : Column
		{
			/// <summary>
			/// Creates an instance of String.
			/// </summary>
			public String(string name): this(name, null)
			{
			}

			/// <summary>
			/// Creates an instance of String.
			/// </summary>
			public String(string name, Hash options): this(name, ColumnAttributes.None, options)
			{
			}

			/// <summary>
			/// Creates an instance of String.
			/// </summary>
			public String(string name, ColumnAttributes attributes, Hash options)
				: base(name, DbType.String, attributes, options)
			{
				if (Length == 0)
					Length = 255;
			}
		}

		#endregion

		#region Nested type: StringFixedLength

		/// <summary>
		/// Maps to NChar (MsSql)
		/// </summary>
		public class StringFixedLength : Column
		{
			/// <summary>
			/// Creates an instance of StringFixedLength
			/// </summary>
			public StringFixedLength(string name): this(name, null)
			{
			}

			/// <summary>
			/// Creates an instance of StringFixedLength
			/// </summary>
			public StringFixedLength(string name, Hash options): this(name, ColumnAttributes.None, options)
			{
			}

			/// <summary>
			/// Creates an instance of StringFixedLength
			/// </summary>
			public StringFixedLength(string name, ColumnAttributes attributes, Hash options): base(name, DbType.StringFixedLength, attributes, options)
			{
				Length = 255;
			}
		}

		#endregion

		#region Nested type: Time

		/// <summary>
		/// Maps to DateTime (MsSql)
		/// </summary>
		public class Time : Column
		{
			public Time(string name): this(name, null)
			{
			}

			public Time(string name, Hash options): base(name, DbType.Time, options)
			{
			}
		}

		#endregion

		#region Nested type: Xml

		/// <summary>
		/// Maps to XMl (MsSql)
		/// </summary>
		public class Xml : Column
		{
			/// <summary>
			/// Creates an instance of Xml.
			/// </summary>
			public Xml(string name, Hash options)
				: base(name, DbType.Xml, options)
			{
			}
		}

		#endregion
	}
}